import React, {Component, PropTypes} from 'react';
import moment from 'moment';

import { Table  } from 'antd';

const dateFormat = 'YYYY-MM-DD HH:mm:ss';
export default class Room extends Component {
  constructor (props) {
    super(props);

    /**
     * table头部
     * @type {*[]}
     */
    this.columns = [{
      title: '考场名称',
      width: 150,
      dataIndex: 'room_name'
    }, {
      title: '考试日期',
      width: 150,
      dataIndex: 'room_date'
    },{
      title: '考试时间',
      width: 150,
      render : (text,record) => {
        return (
          <spa>{record.room_start_time} ~ {record.room_end_time}</spa>
        )
      }
    },{
      title: '容纳人数',
      width: 80,
      dataIndex: 'room_number'
    },{
      title: '监考教师',
      dataIndex: 'room_teacher'
    }];
  }

  componentDidMount () {
    this.props.examActions.getRoomList({
      exam_id : parseInt(this.props.$loki)
    });
  }

  render() {
    const {exam} = this.props;
    const list = exam.get('roomlist') && exam.get('roomlist').toArray();
    return (
      <Table
        bordered
        columns={this.columns}
        dataSource={list}
        pagination={false}
      />
    )
  }

}
